<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta name="format-detection" content="telephone=no, email=no"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
</head>
<body>

<button id="myBtn">按钮</button>

<script>

    var str = "name=jack&age=18"

    document.getElementById("myBtn").onclick = function () {
        var xhr;
        if(window.XMLHttpRequest){
            xhr = new XMLHttpRequest()
        }else{
            xhr = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xhr.open("get","data/1.txt?"+str,true);
        xhr.send();
        xhr.onreadystatechange = function(){
            if(xhr.readyState == 4){
                if(xhr.status==200){
                    console.log(xhr.responseText)
                }
            }
        };
        console.log(11);
    }


</script>

</body>
</html>